package week6;

public class AccountX {
    private Account[] customer = new Account[30];
    private int n = 1;
    private double Rate = 0.035;

    public AccountX(){
        customer[0] = new Account("银行长", 0);
    }

    public void addCustomer(Account cus){//添加账户
        customer[n] = cus;
        n++;
    }

    public double deposit(int n, double amount) {
        double result = customer[n].deposit(amount);
        return result;
    }

    public double withdraw(int n, double amount, double fee) {
        double result = customer[n].getBalance();
        System.out.println(n + "号取钱中..." );
        if (customer[n].getBalance() >= amount + fee)
            result = customer[n].withdraw(amount, fee);
        else
            System.out.println("No enough money.");
        System.out.println("取钱完毕.");
        return result;
    }

    public void addRate() {
        Rate += 0.03;
    }

    public double getBalance(int n) {
        double result = customer[n].getBalance();
        return result;
    }

    public double getRate() {
        return Rate;
    }
}
